<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>宝钢彩涂板管理后台</title>
    <link rel="stylesheet" href="/static/css/normalize.css">
	<link rel="stylesheet" href="/static/css/list.css">
	<link rel="stylesheet" href="/static/css/color-style.css">
	<link rel="stylesheet" href="/static/css/font-awesome.min.css">
    <script type="text/javascript" src="/static/js/jquery-1.11.1.min.js"></script>
</head>
<body>
	<!-- 列表内容 -->
	<div class="list-box">
		<div class="searchbox">
			<form action="" class="form-inline">
				<div class="el-form-item">
					<div class="el-form-item__content">
						<div class="el-input el-input--medium">
							<h2>导航列表</h2>
						</div>
					</div>
				</div>
			</form>
			<div class="button-container" style="float: right;">
				<button type="button" class="button -green center add" style="line-height: 1.4; margin-top: 3px; width: 80px;">
					<i class="fa fa-plus"></i>
					<span class="span-search">添 加</span>
				</button>
			</div>
		</div>
		<div id="MainForm">
			<div class="form_boxA">
				<table cellpadding="0" cellspacing="0">
					<tr>
						<th><input type="checkbox"></th>
						<th>序号</th>
						<th>导航名称</th>
						<th>父级导航</th>
						<th>地址</th>
						<th>是否显示</th>
						<th>排序</th>
						<th style="width: 150px;">操作</th>
					</tr>
					{foreach $nav_arr as $key => $value}
						<tr>
							<td><input type="checkbox"></td>
							<td>{$value.id}</td>
							<td>{$value.nav_name}</td>
							<td>{$value.nav_parent_name}</td>
							<td>{$value.nav_url}</td>
							<td>{if condition="$value.is_show == 1"}是{else/}否{/if}</td>
							<td class="can_edit"><input class="cancel_border" type="text" data="{$value.id}" value="{$value.nav_sort}"  onkeyup="value=value.replace(/[^\d]/g,'')" redeonly></td>
							<td><a href="{:Url('nav/delete',[ 'id'=> $value['id'] ])}" style="color: #ff1a29">删除</a> | <a href="{:Url('nav/edit',[ 'id'=> $value['id'] ])}">修改</a></td>
						</tr>
					{neq name="$value.child" value=""}
						{foreach $value.child as $k => $v}
							<tr>
								<td><input type="checkbox"></td>
								<td>{$v.id}</td>
								<td>{$v.nav_name}</td>
								<td>{$v.nav_parent_name}</td>
								<td>{$v.nav_url}</td>
								<td>{if condition="$v.is_show == 1"}是{else/}否{/if}</td>
								<td class="can_edit"><input class="cancel_border" type="text" data="{$v.id}" value="{$v.nav_sort}" onkeyup="value=value.replace(/[^\d]/g,'')" redeonly></td>
								<td><a href="{:Url('nav/delete',[ 'id'=> $v['id'] ])}" style="color: #ff1a29">删除</a> | <a href="{:Url('nav/edit',[ 'id'=> $v['id'] ])}">修改</a>
							</tr>
						{/foreach}
					{/neq}
					{/foreach}
				</table>
			</div>
		</div>

		<div class="clear"></div>
	</div>
</body>
<script>
	$('.add').click(function(){
	    window.location.href="{:Url('nav/add')}";
	});

	/* 排序点击显示input */
//	(function() {
		$('.can_edit').click(function() {;
			$(this).children('input').removeAttr('redeonly')
		})
		.children('input').blur(function() {
		    var data = $(this).val();
		    var id = $(this).attr('data');
			$(this).attr('redeonly', 'true')
			$.post('{:Url("Nav/lst")}',{data:data,id:id},function(r){
			});
		})
//	}())
</script>
</html>